#include<iostream>
#include<unistd.h>
using namespace std;
int main()
{
	pid_t ret=fork();
	if(ret <0)
	{
		perror("fork");
		return 1;
	}
	else if(ret ==0)
	{
		cout<<"子进程id："<<getpid()<<endl;
		sleep(30);
	}
	else
	{
		cout<<"父进程id："<<getpid()<<endl;
		sleep(10);
		exit(0);
	}
	return 0;
}
